<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link href="../../../static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="../../../static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="../../../static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="../../../static/css/animate.min.css" rel="stylesheet">
    <link href="../../../static/css/style.min.css?v=4.0.0" rel="stylesheet">
    <link href="../../../static/css/plugins/pagination/pagination.css" rel="stylesheet">
    <link href="../../../static/css/plugins/popup/popup.css" rel="stylesheet">
    <link href="../../../static/css/common.css" rel="stylesheet">
    <base target="_blank">
    <style>
        .add-box input{
           float:none;
           text-align:left;
           text-indent:1em;
        }
        .user-mation li{
          display:flex;
          line-height:30px;
        }
        .user-mation li span{
          white-space:nowrap;
        }
		.input-change{
			float:none;
			width: 100%;
			max-width: 260px;
			height: 34px;
            line-height: 34px;
			text-align:left;
			text-indent:1em;
			display: block;
			margin-bottom: 10px;
			margin-left: 0;
			border-radius: 4px;
		}
		.change-psw{
			margin-left: 40px;
		}
		.add-box{
			width: 100%;
			max-width: 280px;
		}
		.add-box input{
		   margin-bottom: 20px;
		   text-align: left;
		   text-indent: 1em;
		   float: none;
		}
    </style>

  </head>
  <body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>基本信息</h5>
            </div>
            <div class="ibox-content">
               <!-- <div class="col-sm-6"> -->
                   <div class="user-mation">
                       <div class="ibox-title">
                           <h5>用户基本信息</h5>
                       </div>
                       <ul>
						  <li>
							  <span class="gameUserId">玩家ID：</span><p></p>
						  </li>
                          <li>
                              <span class="loginName">登录账号：</span><p></p>
                          </li>
                          <li>
                              <span class="roomCards">剩余房卡数量：</span><p></p>
                          </li>
						  <li>
						      <span class="goldCoins">剩余金币数量：</span><p></p>
						  </li>
                       </ul>
					  <!-- <div class="ibox-title">
					       <h5>修改密码</h5>
					   </div> -->
					   <!-- <input class="input-change" name="password" type="password" placeholder="请输入新密码" /> -->
					   <button class="btn btn-primary change-psw">修改密码</button>
                   </div>
               <!-- </div> -->
            </div>
        </div>
    </div>

    <script src="../../../static/js/jquery.min.js?v=2.1.4"></script>
    <script src="../../../static/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="../../../static/js/plugins/popup/popup.js"></script>
	<script src="../../../static/js/http.js"></script>
    <script type="text/javascript">
        _POST('/gameUser/proxyInfo',{}).then(function(res){
			$('.gameUserId').siblings('p').text(res.data.gameUserId);
			$('.loginName').siblings('p').text(res.data.loginName);
			$('.roomCards').siblings('p').text(res.data.gameUser.roomCards)
			$('.goldCoins').siblings('p').text(res.data.gameUser.goldCoins);
		})
		
		$('.change-psw').on('click',function(){
			inputModal(function(val){
				var params = {
					password:val
				}
				_POST('/system/user/resetPwd',params).then(function(res){
					//修改成功
					popup.closeModal('.popup-closeModal');
					popup.tips('修改成功请重新登录',1000);
					setTimeout(function(){
						window.parent.toLogin()
					},500)
				})
			})
		})
		
		$('.submit').on('click',function(){
			var psw = $.trim($('input[name="password"]').val());
			if(!psw){
				popup.tips('请输入新密码',1000);
				return;
			}
			var params = {
				password:psw
			}
			_POST('/system/user/resetPwd',params).then(function(res){
				//修改成功
				popup.tips('修改成功请重新登录',1000)
				setTimeout(function(){
					window.parent.toLogin()
				},500)
			})
		})
		
		 function inputModal(callback){
			 var formHtml = '<div class="add-box">'+
									'<input class="input-change" name="password" type="password" placeholder="请输入新密码" />'+
							'</div>';
			 popup.alert({
				 title:'修改密码',
				 val:formHtml,
				 sureCb:function(){
					 var val = $.trim($('.input-change').val());
					 if(!val){
						 popup.tips('请输入新密码',1000);
						 return;
					 }else{
						 callback&&callback(val);
					 }
				 }
			 })
		}
    </script>
  </body>
</html>
